package com.sx.db.sharding.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sx.db.sharding.entity.SxOperate;
import com.sx.db.sharding.mapper.SxOperateMapper;
import com.sx.db.sharding.service.SxOperateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 操作日志Service实现类
 */
@Service
public class SxOperateServiceImpl extends ServiceImpl<SxOperateMapper, SxOperate> implements SxOperateService {

    @Autowired
    private SxOperateMapper sxOperateMapper;

    @Override
    public List<SxOperate> getByUserId(Long userId) {
        QueryWrapper<SxOperate> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        queryWrapper.orderByDesc("operate_time");
        return sxOperateMapper.selectList(queryWrapper);
    }
}